<?php

require 'connect.php';

function request($id_barang, $jumlah) { 
    include 'connect.php';
    $id_stok_logk = rand(0, 1000); //nanti perlu penyesuaian lagi
    $tanggal = date("Y-m-d");
    $id_unitkerja = "(SELECT `id_unitkerja` FROM
        `MENGELOLA_BARANG` WHERE id_barang='$id_barang')";
    $input_query = mysqli_query($con,"INSERT INTO `STOK_LOG_KURANG` 
        (`id_stok_logk`, `id_bhp`, `id_unitkerja`, `jumlah`, `tanggal`, `flag` ) 
        VALUES ('$id_stok_logk', '$id_barang', $id_unitkerja, '$jumlah', '$tanggal', 0 );");

    if ($input_query) {
        echo 'brhasil insert~'; //nanti disesuaikan deh
    } else {
        echo 'gagala insert~'; //nanti disesuaikaneun deuh
    }
}
?>
